# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=ghostcloud
pkgver=0.9.9.5
pkgrel=2
_commit_qwebdavlib="0e9d02263b8ca7a8dd0330dd66515563108954be"
_commit_libqtcommandqueue="05ce5cfd42053da019b6636e7f57cebeeb83ebc4"
_commit_qml_ui_set="81b610b296f325f6b2607dd99f06bad2545783e4"
_commit_breeze_icons="e7058284a0106497d5f91e82a03acb159f87886e"
pkgdesc="A modern cross-platform client for Nextcloud, ownCloud & WebDav"
url="https://github.com/fredldotme/harbour-owncloud"
arch="all"
license="GPL-2.0-only AND LGPL-2.1-only"
depends="qt5-qtbase-sqlite"
makedepends="
	chrpath
	qt5-qtbase-dev
	qt5-qtdeclarative-dev
	qt5-qtmultimedia-dev
	qt5-qtquickcontrols2-dev
	qt5-qtsvg-dev
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/fredldotme/harbour-owncloud/archive/refs/tags/$pkgver.tar.gz
	$pkgname-qwebdavlib-$_commit_qwebdavlib.tar.gz::https://github.com/fredldotme/qwebdavlib/archive/$_commit_qwebdavlib.tar.gz
	$pkgname-libqtcommandqueue-$_commit_libqtcommandqueue.tar.gz::https://github.com/fredldotme/libqtcommandqueue/archive/$_commit_libqtcommandqueue.tar.gz
	$pkgname-qml-ui-set-$_commit_qml_ui_set.tar.gz::https://github.com/fredldotme/qml-ui-set/archive/$_commit_qml_ui_set.tar.gz
	$pkgname-breeze_icons-$_commit_breeze_icons.tar.gz::https://invent.kde.org/frameworks/breeze-icons/-/archive/$_commit_breeze_icons.tar.gz
	"
options="!check" # No tests
builddir="$srcdir/harbour-owncloud-$pkgver"

prepare() {
	default_prepare

	rmdir \
		3rdparty/qwebdavlib \
		3rdparty/libqtcommandqueue \
		3rdparty/qml-ui-set \
		src/app/icons/breeze-icons
	mv "$srcdir/qwebdavlib-$_commit_qwebdavlib" 3rdparty/qwebdavlib
	mv "$srcdir/libqtcommandqueue-$_commit_libqtcommandqueue" 3rdparty/libqtcommandqueue
	mv "$srcdir/qml-ui-set-$_commit_qml_ui_set" 3rdparty/qml-ui-set
	mv "$srcdir/breeze-icons-$_commit_breeze_icons" src/app/icons/breeze-icons

	#ln -s src/app/icons/theme src/app/icons/breeze-icons/icons
}

build() {
	qmake-qt5 \
		CONFIG+=noadditionals \
		CONFIG+=quickcontrols
	make
}

package() {
	INSTALL_ROOT="$pkgdir" make install
	chrpath -d "$pkgdir"/usr/bin/harbour-owncloud

	install -Dm644 src/app/icons/harbour-owncloud.svg -t "$pkgdir"/usr/share/icons/hicolor/scalable/apps
	install -Dm644 src/app/icons/86x86/harbour-owncloud.png -t "$pkgdir"/usr/share/icons/hicolor/86x86/apps
	install -Dm644 src/app/icons/108x108/harbour-owncloud.png -t "$pkgdir"/usr/share/icons/hicolor/108x108/apps
	install -Dm644 src/app/icons/128x128/harbour-owncloud.png -t "$pkgdir"/usr/share/icons/hicolor/128x128/apps
	install -Dm644 src/app/icons/172x172/harbour-owncloud.png -t "$pkgdir"/usr/share/icons/hicolor/172x172/apps
	install -Dm644 src/app/icons/harbour-owncloud_512.png "$pkgdir"/usr/share/icons/hicolor/512x512/apps/harbour-owncloud.png
}

sha512sums="
8485993a1129cca9e72dfb7767ba79f8412bd359af09cc5a9290d614127f57b24e71bda4fec65414d600719168aed06ba63e05f7d8e88f8440db9bf718e974cc  ghostcloud-0.9.9.5.tar.gz
5e1957fcb6c53ac9a1c5d4321a389b93bada693502bd69094eb6e9dc1e08c438a020c626d3e8b19093c2163d8f3f22015866f51fcb5818888be0a1647d718e4a  ghostcloud-qwebdavlib-0e9d02263b8ca7a8dd0330dd66515563108954be.tar.gz
d048eb7170e0c623f274927af8aacb8be695e129ddb1f2b48f38ec4acc163d328873b169d04a8430a47015aa0212ae969ea3f6d1ca140a1106b0534da9af1830  ghostcloud-libqtcommandqueue-05ce5cfd42053da019b6636e7f57cebeeb83ebc4.tar.gz
69236fd799624d45a2df0780bd9a16ce8e62715d6bd437d1fb20f0b340a8c67a3f0dddedd6ab9b17394a2df59701ce2a47b24bccbe345465c821db91dd51658f  ghostcloud-qml-ui-set-81b610b296f325f6b2607dd99f06bad2545783e4.tar.gz
1f47a5a511eaac42db43242eb578aaf2e358277fe8d910e5ebe8dc09d9d514d14897c1c168c2dfca73336e885a9ed845f311507351bdb335bf594f1480e5cd65  ghostcloud-breeze_icons-e7058284a0106497d5f91e82a03acb159f87886e.tar.gz
"
